realize-class expands the class definitions and appends them together, and performs instrument definitions. If you want just to return the expanded classes you may do that with expand-class function.
In the following :all classes are realized and instruments instr1..instr4 created. Instead of :all you may specify a list of classes you want to realize, for example '(zone tonality symbol velocity length program). The sections are given as a list of section names used in class definitions.
(realize-class :all
instr1 '(intro part1 part2 part3 part4 coda)
instr2 '(intro part1 part2 part3 part4 coda)
instr3 '(intro part1 part2 part3 part4 coda)
instr4 '(intro part1 part2 part3 part4 coda)
)
If you are using the Class System to build up composition structures, the composition structure can be defined at the beginning of the composition with def-grammar, for example:
(def-grammar 'structure
fugue (intro variations coda)
variations (part1 part2 part3 part4)
)
This grammar is expanded into a linear structure with expand-grammar.
(expand-grammar fugue 2 'structure)
--> (intro part1 part2 part3 part4 coda)
You can now realize the classes by:
(realize-class :all
instr1 (expand-grammar fugue 2 'structure)
instr2 (expand-grammar fugue 2 'structure)
instr3 (expand-grammar fugue 2 'structure)
instr4 (expand-grammar fugue 2 'structure)
)
After class realization you may still define instrument parameters for example to set up the gobal program and channel values.
(def-channel
instr1 1
instr2 2
instr3 3
instr4 4
)
(def-program gm-sound-set
instr1 clavi
instr2 lead-1-square
instr3 clavi
instr4 lead-1-square
)
And then, compile all the instruments using the compile-instrument.